<html>
<head>
  <title>Planets</title>
  <script src="./processing-1.1.0.min.js"></script>
  <script type="application/javascript">  
    var gameState = {"READY" : 0,
                     "RUNNING" : 1,
                     "PAUSED" : 2,
                     "GAME_OVER" : 3 };

    var processingInstance;  

    function switchTo(state) {  
      if (!processingInstance)
        processingInstance = Processing.getInstanceById('planets');

      processingInstance.switchTo(state);
    }  
  </script>  
</head>
<body>
  <button onClick="switchTo(gameState.RUNNING);">GO!</button>
  <button onClick="switchTo(gameState.PAUSED);">PAUSE!</button>
  <button onClick="switchTo(gameState.READY);">RESET!</button>
  <div>
  <canvas id="planets" data-processing-sources="./main.pjs"></canvas>
  </div>
</body>
</html>
